<script setup>
import {signApproved} from "@/api/contract/processContract.js";
import {backProcessConList} from "@/utils/backList.js";
import FlowInfoView from "@/views/contract/process/processing/flowInfo/common/flowInfoView.vue";
import {pageofficeOpenFile} from "@/plugins/pageoffice/pageoffice-common.js";

const {proxy} = getCurrentInstance()
const prop = defineProps({
  conId: {
    type: Number
  },
  flowInfoButtons: {
    type: JSON
  },
  isRefreshActivityNote: {
    type: Boolean,
  }
})
const openFileUrl = '/contract/processing/sign/openFile/' + prop.conId

function handleApproved() {
  proxy.$modal.confirmAndExecuteJS('确认已签订完毕？', signApproved, prop.conId, backProcessConList)
}

function handleCompare() {
  if (prop.flowInfoButtons.isCompareClick) {
    pageofficeOpenFile('/contract/processing/sign/openFileCompare/' + prop.conId, prop.conId)
  }
}

</script>

<template>
  <FlowInfoView :conId="conId" :openFileUrl="openFileUrl" :isBack="flowInfoButtons.isBack" :isRefreshActivityNote="isRefreshActivityNote">
    <el-button type="success" @click="handleApproved" v-if="flowInfoButtons.isSign">已盖章</el-button>
    <el-tooltip  placement="top">
      <template #content > 文件为非固定格式时，可对文件正文的初始版本和审计完毕版本文件正文进行比较和查看变动内容</template>
      <el-button type="danger" @click="handleCompare" :class="flowInfoButtons.isCompareClick ? '' : 'custom-disabled-button-with-tooltip' " >查看变动</el-button>
    </el-tooltip>
  </FlowInfoView>
</template>

<style scoped>
.custom-disabled-button-with-tooltip {
  /* 这里添加你需要的禁用按钮样式 */
  cursor: not-allowed;
  opacity: 0.6;
}
</style>

